package com.topboya.linker.ui.activity;

import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.SlidingTabLayout;
import com.flyco.tablayout.listener.CustomTabEntity;
import com.topboya.linker.R;
import com.topboya.linker.ui.base.Presenter.BasePresenter;
import com.topboya.linker.ui.base.activity.BaseActivity;
import com.topboya.linker.ui.base.adapter.CommonFragmentPagerAdapter;
import com.topboya.linker.ui.base.fragment.BaseFragment;
import com.topboya.linker.ui.fragment.NotifyMsgFragment;
import com.topboya.linker.ui.fragment.NotifyNoticeFragment;

import java.util.ArrayList;

public class NotifyActivity extends BaseActivity {

    private static final String TAG = "NotifyActivity";
    private SlidingTabLayout tab_notify_label;
    private ViewPager vp_mynotify;
    private TextView toolbar_title;
    private TextView tv_toolbar_right;
    private Toolbar toolbar;
    @Override
    protected int getLayoutId() {

        return R.layout.activity_notify;
    }

    @Override
    protected void initView() {

        toolbar = findViewById(R.id.toolbar);
        tab_notify_label = findViewById(R.id.tab_notify_label);
        vp_mynotify = findViewById(R.id.vp_mynotify);
        toolbar_title = findViewById(R.id.toolbar_title);
        tv_toolbar_right = findViewById(R.id.tv_toolbar_right);
        toolbar_title.setText("我的通知");
        tv_toolbar_right.setVisibility(View.GONE);
    }

    @Override
    protected void initData() {


        ArrayList<BaseFragment> fragmentList = new ArrayList<>();
        fragmentList.add(new NotifyMsgFragment());
        fragmentList.add(new NotifyNoticeFragment());
        CommonFragmentPagerAdapter commonFragmentPagerAdapter = new CommonFragmentPagerAdapter(getSupportFragmentManager(),fragmentList);
        vp_mynotify.setAdapter(commonFragmentPagerAdapter);
        tab_notify_label.setViewPager(vp_mynotify,new String[]{"通知","公告"});

    }

    @Override
    protected void initListener() {
        toolbar.setNavigationOnClickListener(v -> { finish();});
        vp_mynotify.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {


            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });

    }

    @Override
    protected BasePresenter createPresenter() {

        return null;
    }
}
